/** @file DisconnectCommand.h
    @class DisconnectCommand
    @brief Command that says that a user disconnects from the server

    description
*/
#ifndef __DisconnectCommand_h_
#define __DisconnectCommand_h_

#include "Command.h"
#include <Windows.h>
class DisconnectCommand : public Command {
public:
	/**
	* @brief The constructor
	*/
	DisconnectCommand (unsigned int playerId)
		: Command(playerId) {}

	/**
	* @brief The empty constructor
	*/
	DisconnectCommand() {}
	
	/**
	* @brief The destructor
	*/
	virtual ~DisconnectCommand (void) {}
	
	/**
	* @brief Executs the command on argument model
	*/
	virtual bool execute(Model *model) {
		model->getByID(getPlayerId())->kill();
		return true;
	}
	
	/**
	* @brief Saves the command to a output file stream
	*/
	virtual void save(ofstream &ofs) {
		int i = SPAWNCOMMAND;
		ofs.write((char*) &i, sizeof(int));
		Command::save(ofs);
  }

	/**
	* @brief Loads a command from a input file stream
	*/
  virtual void load(ifstream &ifs) {
		Command::load(ifs);
  }

	/**
	* @brief Saves the command to a bit stream
	*/
  virtual void save(RakNet::BitStream &ofs) {
		int i = SPAWNCOMMAND;
		ofs.Write((char*) &i, sizeof(int));
		Command::save(ofs);
  }

	/**
	* @brief Loads a command from a bit stream
	*/
  virtual void load(RakNet::BitStream &ifs) {
		Command::load(ifs);
  }

private:
	
};
#endif